<?php
    //获取当前容器ip
    $output = shell_exec('hostname -I');
    $ips = explode(' ', trim($output));
    $ip = $ips[0] ?? '127.0.0.1';

    return [
        'uri' => (getenv('CONSUL_HOST') ?: 'http://127.0.0.1') . ':8500', // Consul 地址
        'token' => '', // 如有 ACL Token 可填写
        'services' => [
            'http' => [
                'enable' => true,
                'name' => 'mjs-client-http',
                'id' => 'mjs-client-http',
                'tags' => ['http'],
                'address' => $ip,
                'port' => 9501,
                'check' => [
                    'http' => 'http://'.$ip.':9501/health',
                    'interval' => '10s',
                    'timeout' => '5s',
                ],
            ],
            //未调试
            'rpc' => [
                'enable' => false,
                'name' => 'user-service-rpc',
                'id' => 'user-service-rpc-1',
                'tags' => ['json-rpc'],
                'address' => '127.0.0.1',
                'port' => 9502,
                'check' => [
                    'tcp' => '127.0.0.1:9502', // TCP 健康检查
                    'interval' => '10s',
                    'timeout' => '5s',
                ],
            ],
        ],
    ];
